![]() |
PATH![]() |
![]() ![]() |
Navigation Services provides functions to save documents and to query the user about unsaved changes.
NavPutFile
displays a Save dialog box.NavAskSaveChanges
displays a Save Changes alert box.NavCustomAskSaveChanges
displays a Save Changes alert box with a custom alert message.NavAskDiscardChanges
displays an alert box that asks the user whether to discard changes to a particular document.NavCompleteSave
completes a save operation and performs any needed translation on the file.
OSErr NavPutFile (AEDesc *defaultLocation,
NavReplyRecord *reply,
NavDialogOptions *dialogOptions,
NavEventUPP eventProc,
OSType fileType,
OSType fileCreator,
void *callBackUD);
NavReplyRecord
. Upon return, Navigation Services uses this structure to provide data to your application about the results of your
NavPutFile
call.NavDialogOptions
. Before calling
NavPutFile
, you can set up this structure to specify dialog box settings. If you pass
NULL
in this parameter, Navigation Services uses the defaults for all options. see Configuration Option Constants for a description of the default settings.NavEventProcPtr
that points to your application-defined event-handling function. Obtain this UPP by calling the function
NewNavEventProc
. Implementing an event-handling function allows your application to update windows after the user moves or resizes the dialog box. If you pass
NULL
in this parameter, the Save dialog box is not movable or resizable. For more information, see Handling Events .NOTE
If you specify the kNavDontResolveAliases constant as a dialog box option, as described in Configuration Option Constants , before calling the NavPutFile function, Navigation Services returns a paramErr (-50) .
After your application calls the
NavPutFile
function to display a Save dialog box and the user selects a location, enters a filename, and clicks OK,
NavPutFile
closes the dialog box and returns references to the file to be saved in the
NavReplyRecord
structure. Your application should check the
validRecord
field of the
NavReplyRecord
structure; if this field is set to
true
, your application should save the file and call the function NavCompleteSave
.
If you specify the Format pop-up menu in a dialog box displayed by the NavPutFile function, your application must provide adequate kind strings to describe the file types available. If the user uses the Format menu to save a file to a format other than the file's native format, Navigation Services translates the file automatically. If you wish to turn off automatic translation, set to false the value of the translationNeeded field of the NavReplyRecord structure you pass in the reply parameter. If you turn off automatic translation, your application is responsible for any required translation.
For a sample code listing, see A Sample File-Saving Function.
For more information on translation, see Translating Files on Save.
For more information on kind strings, see Inside Macintosh: More Macintosh Toolbox .
Displays a Save Changes alert box.
OSErr NavAskSaveChanges (NavDialogOptions *dialogOptions,
NavAskSaveChangesAction action,
NavAskSaveChangesResult *reply,
NavEventUPP eventProc,
void *callBackUD);
NavDialogOptions
. Before calling
NavAskSaveChanges
, set up this structure to specify dialog box settings. In this case, the
clientName
and
savedFileName
fields are the only two you must supply with values.NavEventProcPtr
that points to your application-defined event-handling function. Obtain this UPP by calling the function
NewNavEventProc
. Implementing an event-handling function allows your application to update windows after the user moves or resizes the dialog box. If you pass
NULL
in this parameter, the Save Changes alert box is not movable. For more information, see Handling Events .This function is useful when your application needs to display an alert when the user attempts to close a document or an application with unsaved changes.
Displays a Save Changes alert box with a custom alert message.
OSErr NavCustomAskSaveChanges(NavDialogOptions *dialogOptions,
NavAskSaveChangesResult *reply,
NavEventUPP eventProc,
void *callBackUD);
NavDialogOptions
. Before calling
NavCustomAskSaveChanges
, set up this structure to specify dialog box settings. In this case, the
message
field is the only one you must supply with a value.NavEventProcPtr
that points to your application-defined event-handling function. Obtain this UPP by calling the function
NewNavEventProc
. Implementing an event-handling function allows your application to update windows after the user moves or resizes the dialog box. If you pass
NULL
in this parameter, the Save Changes alert box is not movable. For more information, see Handling Events .This function is similar to the function NavAskSaveChanges , except you provide a custom alert message. This function is useful when you need to post a Save Changes alert box at times other than quitting or closing a file. Your application can display this alert box if a specified time interval has passed since the user last saved changes, for example.
Displays an alert box that asks the user whether to discard changes to a particular document.
OSErr NavAskDiscardChanges (NavDialogOptions *dialogOptions,
NavAskDiscardChangesResult *reply,
NavEventUPP eventProc,
-!
NavDialogOptions
. Before calling
NavAskDiscardChanges
, set up this structure to specify dialog box settings. In this case, the
savedFileName
field is the only one you must supply with a value. NavEventProcPtr
that points to your application-defined event-handling function. Obtain this UPP by calling the function
NewNavEventProc
. Implementing an event-handling function allows your application to update windows after the user moves or resizes the dialog box. If you pass
NULL
in this parameter, the Discard Changes alert box is not movable. For more information, see Handling Events .If your application provides a Revert to Saved command, you can use the NavAskDiscardChanges function to display a confirmation alert box when a user selects Revert to Saved for a document with unsaved changes. Navigation Services uses the string you supply in the savedFileName field of the NavDialogOptions structure you passed in the dialogOptions parameter to display the alert message, "Discard changes to <savedFilename>?".
Completes a save operation and performs any needed translation on the file.
OSErr NavCompleteSave (NavReplyRecord *translateInfo,
NavTranslateOptions howToTranslate);
NavReplyRecord
. Upon return, Navigation Services uses this structure to provide data to your application about the results of your
NavCompleteSave
call.
You should always call
NavCompleteSave
to complete any file saving operation performed with the
NavPutFile
function.
NavCompleteSave
performs any needed translation, so you do not have to use the function NavTranslateFile
when saving. If you wish to turn off automatic translation, set to
false
the value of the translationNeeded field of the
NavReplyRecord
structure you pass in the
reply
parameter of the
NavPutFile
function. If you turn off automatic translation, your application is responsible for any required translation. For more information, see Saving Files.
Previous | Back Up One Level | Next |